/*
 * @Author: 肖芬芳 1911683843@qq.com
 * @Date: 2022-08-29 11:21:13
 * @LastEditors: 肖芬芳 1911683843@qq.com
 * @LastEditTime: 2022-11-17 10:08:39
 * @FilePath: \node_study\model\connect.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const mongoose = require('mongoose');
// 连接数据库
mongoose.connect('mongodb://127.0.0.1/blog', { useUnifiedTopology: true, useNewUrlParser: true })
    .then(() => console.log('数据库连接成功'))
    .catch(err => console.log(err, '数据库连接失败'));